package calao.client;

import calao.client.i18n.Text;
import calao.client.ui.HasTitle;
import calao.client.ui.TabPanel;

public class PreferencesPanel
extends TabPanel
implements HasTitle
{

	final Desktop desktop;
	final Text text;
	final boolean admin;

	PreferencesPanel(Desktop desktop, boolean admin)
	{
		this.desktop = desktop;
		this.admin = admin;
		this.text = desktop.text;
		newTab(text.desktop(), new DesktopPreferences());
		if (admin) newTab(text.applications(), new ApplicationsForm());
	}
	
	/** Checks whether this panel targets user or workspace preferences.
	 */
	public boolean isUser()
	{
		return !admin;
	}
	
	public String getTitle()
	{
		return admin? text.workspacePreferences() : text.preferences();
	}
			
}
